package ali;

import java.util.Scanner;

public class Q1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        StringBuilder s1 = new StringBuilder();
        StringBuilder s2 = new StringBuilder();

        String x = "\"\"";
        if(s.length()==0) System.out.println(0);
        else if(s.equals(x)) System.out.println(0);
        else {
            for(int i=0;i<s.length();i++){
                int i1 = s.charAt(i) - '0';
                if(i1%2 == 0){
                    if(s2.length() == 0 && i1 == 0) continue;
                    s2.append(String.valueOf(i1));
                }else {
                    if(s1.length() == 0 && i1 == 0) continue;
                    s1.append(String.valueOf(i1));
                }
            }
            long l=0,l1=0;
            if(s1.length()!=0){
                l = Long.parseLong(s1.toString());
            }
            if(s2.length()!=0){
                l1 = Long.parseLong(s2.toString());
            }
            System.out.println(l>l1?l-l1:l1-l);
        }
    }
}
